<template>
	<view class="tabbar">
		<view class="fsb pl15 pt20">
			<view class="logo my10"><image src="../../static/logo/logo.png" mode="" class="block block64"></image></view>
			<view class="nav f16 ash flex my18">
				<view class="mx15 block" v-for="(item, index) in list" :key="index" :class="{ blue: item.route == Route, fwb: item.route == Route }" @click="Tab(item, index)">
					{{ item.name }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					name: '首页',
					route: 'pages/Home/index'
				},
				{
					name: '算力',
					route: 'pages/Computing/index'
				},
				{
					name: '我的',
					route: 'pages/User/index'
				}
			],
			Route: '',
			TabIndex: 0
		};
	},
	mounted() {
		let url = getCurrentPages();
		this.Route = url[url.length - 1].route;
		uni.hideTabBar()
	},
	methods: {
		Tab(item, index) {
			if (this.Route == item.route) return;
			this.TabIndex = index;
			uni.switchTab({
				url: '../../' + item.route
			});
		}
	}
};
</script>

<style lang="less">
.block64 {
	width: 64rpx;
	height: 64rpx;
}
</style>
